$(function() {
    var api = CloudApi;
    var $schedules = $("#schedules");
   
    $.getJSON('/schedules.json', function(schedules){
        for(var i=0;i<schedules.length;i++)
        {            
            var html = '<tr>';
            //html += '<td>'+(new moment(schedules[i].created.timestamp)).format('YY/MM/DD hh:mm')+'</td>';
            html += '<td><a href="/schedules/'+schedules[i].uuid+'">'+schedules[i].name+'</a></td>';
            html += '<td>'+schedules[i].enable+'</td>';
            html += '<td>'+schedules[i].cron+'</td>';
            html += '<td><table>';
            for( var j=0;j<schedules[i].actions.length; j++ )
            {
                html += '<tr><td><a href="/actions/'+schedules[i].actions[j]+'">'+schedules[i].actions[j]+'</a></td></tr>';
            }
            html += '</table></td>';
            $('#schedules').append( html );
        }
    });
    
});